package com.q.springboot.mutidatasource.controller;

import com.q.springboot.mutidatasource.entity.TStu;
import com.q.springboot.mutidatasource.entity.TUser;
import com.q.springboot.mutidatasource.service.TStuService;
import com.q.springboot.mutidatasource.service.TUserService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * (TStu)表控制层
 *
 * @author makejava
 * @since 2020-07-10 15:18:46
 */
@RestController
@RequestMapping("select")
public class TStuController {
    /**
     * 服务对象
     */
    @Resource
    private TStuService tStuService;
    @Resource
    private TUserService tUserService;


    /**
     * 通过主键查询单条数据
     *
     * @param id 主键
     * @return 单条数据
     */
    @GetMapping("master/stu/{id}")
    public TStu stu(@PathVariable("id") Integer id) {
        return this.tStuService.queryById(id);
    }

    @GetMapping("cluster/user/{id}")
    public TUser user(@PathVariable("id") Integer id) {
        return this.tUserService.queryById(id);
    }

}